<div class="content">
	<div class="content_header_left">
		<!-- Start Content Header Left -->
		<?php include("ws_includes/1_ws_inc_priviligestring.php"); ?>
		<?php include("ws_includes/2_ws_inc_headerlabel.php"); ?>
		<!-- End Content Header Left -->
	</div>
	<div class="content_header_right">
		<!-- Start Content Header Right -->
		<?php if($privilegeAdd == 1) { ?>
		<a title="Add" href="action/act_submodules_addedit.php" class="nyroModal">
			<img src="<?php echo getURLdomain(); ?>/source/global/img/add-icon.png" width="24">
		</a>
		<?php } ?>
		<!-- End Content Header Right -->
	</div>
	<div style="clear:both;"></div>
	<div class="content_body">
		<!-- Start Content Body -->
		<?php
			$sql_sub = "select a.modulesuburltype, a.modulesubid 
						from ms_module_sub a
							left join ms_module b
								on a.moduleid = b.moduleid and b.stsrc = 'A'
						where a.stsrc = 'A' 
							and a.modulesuburltype = 'module' 
						order by b.moduleposition asc, a.modulesubposition asc
						";
			$exe_sub = mysql_query($sql_sub) or die(mysql_error());
			$num_sub = mysql_num_rows($exe_sub);
			
			if($num_sub > 0)
			{
		?>
		<table id="table" border="1" cellpadding="2" cellspacing="0">
		<thead>
			<tr>
				<th filter="false">#</th>
				<th>Position</th>
				<th>Name</th>
				<th>Label</th>
				<th>Parent</th>
				<th filter-type='ddl'>Status</th>
				<th filter="false">Action</th>
			</tr>
		</thead>
		<?php
				$number_count = 1;
				while($row_sub = mysql_fetch_array($exe_sub))
				{
					if($row_sub['modulesuburltype'] == "management")
					{
						//echo "asd";die();
						$sql_dtl = "select 	a.moduleadminname as modulename, a.stsrc as statusrecord, a.moduleadminposition as moduleposition, 
											b.* 
									from ms_module_admin a 
										left join ms_module_sub b 
											on a.moduleadminid = b.moduleid
												and b.stsrc = 'A'
									where b.modulesubid = '".$row_sub['modulesubid']."' 
										
									";
					}
					else
					{
						//echo "asdqwe";die();
						$sql_dtl = "select 	a.modulename as modulename, a.stsrc as statusrecord, a.moduleposition as moduleposition, 
											b.* 
									from ms_module a 
										left join ms_module_sub b 
											on a.moduleid = b.moduleid
												and b.stsrc = 'A'
									where b.modulesubid = '".$row_sub['modulesubid']."' 
										
									";
					}
					$exe_dtl = mysql_query($sql_dtl) or die(mysql_error());
					$row = mysql_fetch_array($exe_dtl);
					
					
		?>
			<tr>
				<td><?php echo $number_count; ?></td>
				<td><?php echo $row['moduleposition']."-".$row['modulesubposition']; ?></td>
				<td><?php echo $row['modulesubname']; ?></td>
				<td><?php echo $row['modulesublabel']; ?></td>
				<td>
					<?php 
						if($row['statusrecord'] != "A")
						{
					?>
							<img src="<?php echo getURLdomain(); ?>/source/global/img/exclamation-icon-red.png" width="24">
					<?php
						}
						else
						{
							echo $row['modulename'];
						} 
					?>
				</td>
				<td>
					<?php if($row['modulesubstatus'] == 1){echo "<span style='color:green;'>ON</span>";}else{echo "<span style='color:red;'>OFF</span>";} ?>
				</td>
				<td>
					<div style="width:100%;">
						<div class="divRowActionCell">
							<div class="divRowAction">
								<a title="Preview" href="action/act_submodules_preview.php#<?php echo $row['modulesubid']; ?>" class="nyroModal">
									<img src="<?php echo getURLdomain(); ?>/source/global/img/preview-icon.png" width="24">
								</a>
							</div>
							<?php if($privilegeEdit == 1) { ?>
							<div class="divRowAction">
								<a title="Edit" href="action/act_submodules_addedit.php#<?php echo $row['modulesubid']; ?>" class="nyroModal">
									<img src="<?php echo getURLdomain(); ?>/source/global/img/edit-icon.png" width="24">
								</a>
							</div>
							<?php } ?>
							<?php if($privilegeDelete == 1) { ?>
							<div class="divRowAction">
								<a title="Delete" href="action/act_submodules_delete.php#<?php echo $row['modulesubid']; ?>" class="nyroModal">
									<img src="<?php echo getURLdomain(); ?>/source/global/img/delete-icon.png" width="24">
								</a>
							</div>
							<?php } ?>
							<div class="clear"></div>
						</div>
					</div>
				</td>
			</tr>
		<?php
					$number_count++;
				}
			}
			else
			{
		?>
				No data !
		<?php
			}
		?>
		</table>
		<!-- End Content Body -->
	</div>
	<div style="clear:both;"></div>
</div>
